Repository navigation
fix: iOS crash when room back button unread label toggles - #7811
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
WalkthroughLeftButtons now uses a single-space label when the unread count is absent or zero. A test verifies the label remains mounted as the count changes from null to 3 and then 0. ChangesUnread label behavior
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Suggested labels: Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
|
iOS Build Available Rocket.Chat 4.78.0.110019 |
The RoomView function-component migration started passing `label={undefined}`
to HeaderBackButton when there are no unreads (it used to pass ' '). On iOS
the label is rendered inside RNCMaskedView, a legacy (Paper) view mounted
through Fabric's legacy interop layer. Its layout-only label wrapper is
flattened, so the label texts are direct children of the masked view: 2
children without a label, 4 with one. When the label appears, disappears and
appears again, the interop layer inserts the last text at index 3 into a
2-element reactSubviews array and throws NSRangeException
"index 3 beyond bounds [0 .. 1]".
Always passing a blank label keeps the masked view's children stable, as
before 4.77.0.
9da57dd to
d06d900
Compare
Proposed changes
Fixes an iOS crash (
NSRangeException: index 3 beyond bounds [0 .. 1]) that happens in RoomView when the back button's unread label toggles. It started in 4.77.0.LeftButtonspassed anundefinedlabel toHeaderBackButtonwhen there were no unreads, where it used to pass' '. On iOS,@react-navigation/elementsrenders the label insideRNCMaskedView, a Paper-only view mounted through the Fabric legacy interop. Adding or removing the label flips the masked view's child count between 2 and 4. After absent, present, absent, present, the interop inserts at index 3 into a 2-item list and the app crashes.LeftButtonsnow falls back to a blank label, so the child count stays stable. A regression test inLeftButtons.test.tsxcovers the toggle.Issue(s)
https://rocketchat.atlassian.net/browse/NATIVE-1774
How to test or reproduce
Verified:
Screenshots
Types of changes
Checklist
Further comments
On develop, iOS 26 uses the native header and mostly avoids this path (master-detail threads still reach it). iOS below 26 is still affected.
Summary by CodeRabbit